function funSum(f1:()=>number,f2:()=>number):() => number {
    return function():number {
        let n1:number = f1();
        let n2:number = f2();
        return n1 + n2;
    }
}

function fun1():number {
    return 1;
}

function fun2():number {
    return 2;
}

let r2:()=> number = funSum(fun1,fun2);
console.log(r2());

